/*
 * Powered By [fdlm]
 * Web Site: http://www.fdlm.cn
 * Since 2014 - 2015
 */

package com.sjyy.areadict.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

import com.sjyy.areadict.dao.AreadictDao;
import com.sjyy.areadict.model.*;
import com.sjyy.areadict.service.*;
import com.sjyy.areadict.vo.query.*;

import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @author cty email:caotianye@fdlm.cn
 * @version 1.0
 * @since 1.0
 */

@Service
@Transactional
public class AreadictManager extends BaseManager<Areadict,AreadictQuery,java.lang.Integer> implements AreadictService{
	
	@Autowired
	private AreadictDao areadictDao;

	public EntityDao getEntityDao() {
		return this.areadictDao;
	}
	
	@Transactional(readOnly=true)
	public Page findPage(AreadictQuery query) {
		return areadictDao.findPage(query);
	}

	@Override
	public LinkedHashMap<Integer, String> getParentAreadictList() {
		AreadictQuery ctQuery = new AreadictQuery();
	//		ctQuery.set(cityId);
			
			List<Areadict> typeList = findAllByQuery(ctQuery);
			LinkedHashMap<Integer, String> typeMap = new LinkedHashMap<Integer, String>();
			for(Areadict type : typeList){
				if(type == null)
					continue;
				else{
					if(type.getParentAreaId()==null)
						typeMap.put(type.getAreadictId(), type.getAreaName());
				}
			}
			return typeMap;
	}
	
}
